package com.smart.common.exception;

import com.smart.common.enums.ResultCodeEnum;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * @author yangbingquan
 * @version 1.0
 * @date 2021/5/11 15:08
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class BaseException extends Exception {
    /**
     * 错误码
     */
    private String status;
    /**
     * 错误信息
     */
    private String message;

    public BaseException(String status, String message) {
        super(message);
        this.status = status;
    }

    public BaseException(ResultCodeEnum resultCodeEnum) {
        super(resultCodeEnum.getMessage());
        this.status = String.valueOf(resultCodeEnum.getStatus());
    }

    public BaseException(String message) {
        super(message);
    }
}